package schoolWork.work03.text6;

import java.util.Scanner;

public class QuestionDemo {
    public static void main(String[] args) {
        final int SIZE = 5;
        Question[] quiz = new Question[SIZE];
        Scanner reader = new Scanner(System.in);

        //简答题
        quiz[0] = new Question("我国的国庆节是哪一天?");
        quiz[0].setAnswer("10月1日");
        //填空题
        FillInQuestion question1 = new FillInQuestion(
                "\"少年易学老难成，一寸光阴不可轻。\"出自(朱熹)的《劝学诗》。");
        quiz[1] = question1;
        //单选题
        ChoiceQuestion question2 = new ChoiceQuestion();
        question2.setText("下列哪句名言不是出自《论语》?");
        question2.addchoice("厚德载物", true);
        question2.addchoice("敏而好学，不耻下问", false);
        question2.addchoice("三人行，必有我师焉", false);
        question2.addchoice("已所不欲，勿施于人", false);
        quiz[2] = question2;
        //多选题
        MultiChoiceQuestion question3 = new MultiChoiceQuestion();
        question3.setText("下列节日中哪些是我国的传统节日?");
        question3.addchoice("中秋节", true);
        question3.addchoice("端午节", true);
        question3.addchoice("儿童节", false);
        question3.addchoice("重阳节", true);
        quiz[3] = question3;


        NumericQuestion question4 = new NumericQuestion("3*1.5=?");
        question4.setAnswer("4.5");
        quiz[4] = question4;

        for (Question q : quiz) {
            q.display();
            System.out.println("你的答案:");
            String response = reader.nextLine();
            if (q.checkAnswer(response))
                System.out.println("回答正确");
            else
                System.out.println("回答错误");
        }
        reader.close();
    }
}
